using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace Shrapnel
{
	/// <summary>
	/// Additional functionality for our View related to panning
	/// </summary>
	public partial class View
	{
		/// <summary>
		/// View information at the start of panning
		/// </summary>
		private InitialViewState panningStartInfo;



		private void OnPanningStart(Point mousePosition)
		{
			panningStartInfo.viewState = new ViewState(viewState);
			panningStartInfo.mousePosition = mousePosition;
		}

		private void OnPanningStop(Point mousePosition)
		{

		}

		private void OnPanningTick(Point mousePosition)
		{
			viewState.Offset = new PointF(
				panningStartInfo.viewState.Offset.X + (mousePosition.X - panningStartInfo.mousePosition.X),
				panningStartInfo.viewState.Offset.Y + (mousePosition.Y - panningStartInfo.mousePosition.Y));

			Invalidate();
		}
	}
}
